using System;
using System.Collections.Generic;
using System.Text;

namespace OpenSocial.Net
{
	public class Authentication
	{
		/// <summary>
		/// Gets the auth sub proxy URI.
		/// </summary>
		/// <param name="nextUrl">The next URL.</param>
		/// <param name="scope">The scope.</param>
		/// <param name="secure">if set to <c>true</c> [secure].</param>
		/// <param name="session">if set to <c>true</c> [session].</param>
		/// <returns></returns>
		public static Uri GetAuthSubProxyUri(string nextUrl, string scope, bool secure, bool session)
		{
			int sessionBit = session ? 1 : 0;
			int secureBit = secure ? 1 : 0;
			string authUrl = @"https://www.google.com/accounts/AuthSubRequest?scope={0}&session={1}&secure={2}&next={3}";
			string formattedUrl = string.Format(authUrl, scope, sessionBit, secureBit, nextUrl);
			return new Uri(formattedUrl);
		}
	}
}
